<template>
  <div>
    <el-button
        type="success"
        class="handle-del mr10"
        icon="el-icon-back"
        @click="Return()"
    >返回上级</el-button>
    <el-button
        type="primary"
        class="handle-del mr10"
        @click="ShowAllOne()"
    >展示所有一级数据</el-button>
    <el-button
        type="primary"
        class="handle-del mr10"
        @click="ShowTwo()"
    >展示所有二级数据</el-button>
    <el-button
        type="primary"
        class="handle-del mr10"
        @click="ShowThree()"
    >展示所有三级数据</el-button>
<!--    <el-button-->
<!--        type="primary"-->
<!--        class="handle-del mr10"-->
<!--        @click="Import()"-->
<!--    >导入</el-button>-->
<!--    <el-button-->
<!--        type="primary"-->
<!--        class="handle-del mr10"-->
<!--        @click="Export()"-->
<!--    >导出</el-button>-->


    <div>
      <el-select v-model="type" placeholder="请选择">
        <el-option
            v-for="item in optionst"
            :key="item.value"
            :label="item.label"
            :value="item.value">
        </el-option>
      </el-select>
      <el-select v-model="value" placeholder="请选择">
        <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value">
        </el-option>
      </el-select>
      <!--  搜索-->
      <el-input v-model="search" placeholder="请输入要查询的字段的值" style="width: 20%;"></el-input>
      <el-button type="primary" style="margin-top: 10px" @click="ShowSearch()" >查询</el-button>
    </div>
    <el-table
        :data=this.tableData
        border
        style="width: 100%">
      <!--            <el-table-column-->
      <!--                prop="id"-->
      <!--                label="编号"-->
      <!--                width="50"-->
      <!--            >-->
      <!--            </el-table-column>-->
      <el-table-column
          prop="evaluateindex1id"
          label="评估指标I编号"
          width="150">
      </el-table-column>
      <el-table-column
          prop="evaluateindex1name"
          label="评估指标I名称"
          width="280">
      </el-table-column>
      <el-table-column
          prop="evaluateid"
          label="评估体系号"
          width="280">
      </el-table-column>
      <el-table-column
          prop="evaluateindex1content"
          label="评估指标I内容"
          width="280">
      </el-table-column>
      <!--      <el-table-column-->
      <!--          prop="evaluateindex2"-->
      <!--          label="评估指标I内容"-->
      <!--          width="280">-->
      <!--      </el-table-column>-->
<!--      <el-table-column-->
<!--          fixed="right"-->
<!--          label="操作"-->
<!--          width="100">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button @click="edit1(scope.row)" type="text" size="small">修改</el-button>-->
<!--          <el-button @click="del1(scope.row)" type="text" size="small">删除</el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>


    <!--    <el-button-->
    <!--        type="primary"-->
    <!--        class="handle-del mr10"-->
    <!--        @click="ShowTwo()"-->
    <!--    >展示所有二级数据</el-button>-->
    <!--    <el-button-->
    <!--        type="primary"-->
    <!--        class="handle-del mr10"-->
    <!--        @click="TwoAdd()"-->
    <!--    >添加二级指标</el-button>-->
    <!--    <el-button-->
    <!--        type="primary"-->
    <!--        class="handle-del mr10"-->
    <!--        @click="Import()"-->
    <!--    >导入</el-button>-->
    <!--    <el-button-->
    <!--        type="primary"-->
    <!--        class="handle-del mr10"-->
    <!--        @click="Export()"-->
    <!--    >导出</el-button>-->
    <el-table
        :data=this.tableData2
        border
        style="width: 100%">
      <!--            <el-table-column-->
      <!--                prop="id"-->
      <!--                label="编号"-->
      <!--                width="50"-->
      <!--            >-->
      <!--            </el-table-column>-->
      <el-table-column
          prop="evaluateindex1id"
          label="对应评估指标I编号"
          width="150">
      </el-table-column>
      <el-table-column
          prop="evaluateindex2id"
          label="评估指标II编号"
          width="150">
      </el-table-column>
      <el-table-column
          prop="evaluateindex2name"
          label="评估指标II名称"
          width="280">
      </el-table-column>

      <el-table-column
          prop="evaluateindex2content"
          label="评估指标II内容"
          width="280">
      </el-table-column>
<!--      <el-table-column-->
<!--          fixed="right"-->
<!--          label="操作"-->
<!--          width="100">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button @click="edit2(scope.row)" type="text" size="small">修改</el-button>-->
<!--          <el-button @click="del2(scope.row)" type="text" size="small">删除</el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>
    <!--    <el-button-->
    <!--        type="primary"-->
    <!--        class="handle-del mr10"-->
    <!--        @click="ShowThree()"-->
    <!--    >展示所有三级数据</el-button>-->
    <!--    <el-button-->
    <!--        type="primary"-->
    <!--        class="handle-del mr10"-->
    <!--        @click="ThreeAdd()"-->
    <!--    >添加三级指标</el-button>-->
    <!--    <el-button-->
    <!--        type="primary"-->
    <!--        class="handle-del mr10"-->
    <!--        @click="Import()"-->
    <!--    >导入</el-button>-->
    <!--    <el-button-->
    <!--        type="primary"-->
    <!--        class="handle-del mr10"-->
    <!--        @click="Export()"-->
    <!--    >导出</el-button>-->
    <el-table
        :data=this.tableData3
        border
        style="width: 100%">
      <!--            <el-table-column-->
      <!--                prop="id"-->
      <!--                label="编号"-->
      <!--                width="50"-->
      <!--            >-->
      <!--            </el-table-column>-->
      <el-table-column
          prop="evaluateindex2id"
          label="对应评估指标II编号"
          width="150">
      </el-table-column>
      <el-table-column
          prop="evaluateindex3id"
          label="评估指标III编号"
          width="150">
      </el-table-column>
      <el-table-column
          prop="evaluateindex3name"
          label="评估指标III名称"
          width="280">
      </el-table-column>

      <el-table-column
          prop="evaluatevaluetype"
          label="评估指标类型"
          width="280">
      </el-table-column>
      <el-table-column
          prop="evaluatevaluelengthlimit"
          label="评估指标类型长度限制"
          width="280">
      </el-table-column>
      <el-table-column
          prop="evaluatevalueselected"
          label="评估指标值"
          width="280">
      </el-table-column>
      <el-table-column
          prop="evaluatememo"
          label="评估备注"
          width="280">
      </el-table-column>
<!--      <el-table-column-->
<!--          fixed="right"-->
<!--          label="操作"-->
<!--          width="100">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button @click="edit3(scope.row)" type="text" size="small">修改</el-button>-->
<!--          <el-button @click="del3(scope.row)" type="text" size="small">删除</el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>

  </div>

</template>

<script>
import router from "@/router";

export default {
  methods:{
    Return(){
      this.$router.go(-1)
    },
    // page(currentPage){
    //   const _this=this
    //   axios.get('http://localhost:8081/school/page?current='+currentPage+'&size=8').then(function (res) {
    //     // console.log(res.data)
    //     _this.tableData = res.data.schoolList;
    //     _this.total = res.data.total;
    //
    //   })
    // },
    // ShowTwo(){
    //   const _this=this
    //   axios.get('http://localhost:8081/evaluateindex2/findAll').then(function (res){
    //     _this.tableData=res.data
    //     // _this.tableData.append(res.data)
    //   })
    // },
    ShowAllOne(){
      const _this=this
      axios.get('http://localhost:8081/evaluateindex1/findAll').then(function (res){
        _this.tableData=res.data
        // _this.tableData.append(res.data)
      })
    },
    // open() {
    //   this.$alert(`①查询学校举办者代码请输入1 ②查询学校举办者名称请输入2`, '要查询的字段对应关系', {
    //     confirmButtonText: '确定',
    //     callback: action => {
    //       // this.$message({
    //       //   type: 'info',
    //       //   message: `action: ${ action }`
    //       // });
    //     }
    //   });
    // },
    ShowSearch(){
      const _this=this
      console.log(this.type)
      console.log(this.value)
      if (this.type==="1"){
        axios.get("http://localhost:8081/evaluateindex1/search/"+this.value+'/'+this.search).then(function (res){
          console.log("come in")
          _this.tableData=res.data
          console.log(res.data)
          _this.search=''
        })
      }
      if (this.type==="2"){
        axios.get("http://localhost:8081/evaluateindex2/search/"+this.value+'/'+this.search).then(function (res){
          _this.tableData2=res.data
          _this.search=''
        })
      }
      if (this.type==="3"){
        axios.get("http://localhost:8081/evaluateindex3/search/"+this.value+'/'+this.search).then(function (res){
          _this.tableData3=res.data
          _this.search=''
        })
      }

    },

    ShowTwo(){
      const _this=this
      axios.get('http://localhost:8081/evaluateindex2/findAll').then(function (res){
        _this.tableData2=res.data
        // _this.tableData.append(res.data)
      })
    },
    ShowThree(){
      const _this=this
      axios.get('http://localhost:8081/evaluateindex3/findAll').then(function (res){
        _this.tableData3=res.data
        // _this.tableData.append(res.data)
      })
    }


  },

  data(){
    return {
      schoolname:this.$route.query.schoolname,
      evaluatetaskid:this.$route.query.taskid,
      search:'',
      type:'',
      optionst:[
        {
          value: '1',
          label: '评估指标I'
        },
        {
          value: '2',
          label: '评估指标II'
        },
        {
          value: '3',
          label: '评估指标III'
        },
      ],
      options: [
        {
          value: '1',
          label: '评估指标I-评估指标I编号'
        }, {
          value: '2',
          label: '评估指标I-评估指标I名称'
        },
        {
          value: '3',
          label: '评估指标I-评估号'
        },
        {
          value: '4',
          label: '评估指标I-评估指标I内容'
        },
        {
          value: '5',
          label: '评估指标II-评估指标II编号'
        },
        {
          value: '6',
          label: '评估指标II-评估指标II名称'
        },
        {
          value: '7',
          label: '评估指标II-评估指标I编号'
        },
        {
          value: '8',
          label: '评估指标II-评估指标II内容'
        },
        {
          value: '9',
          label: '评估指标III-评估指标III编号'
        },
        {
          value: '10',
          label: '评估指标III-评估指标III名称'
        },
        {
          value: '11',
          label: '评估指标III-评估指标II编号'
        },
        {
          value: '12',
          label: '评估指标III-评估值类型'
        },
        {
          value: '13',
          label: '评估指标III-评估值长度限制'
        },
        {
          value: '14',
          label: '评估指标III-已选择的评估值'
        },
        {
          value: '15',
          label: '评估指标III-评估备注'
        },
      ],
      value: '',
      total:null,
      tableData: null,
      tableData2: null,
      tableData3: null,
      dataList: [],
      fileList: [],
      query: {"page":0, "size":20, count:0},
      column: [
        // {label: "序号", prop: "1id", type: "string"},
        {label: "I编号", prop: "evaluateindex1id", type: "string"},
        {label: "I名称", prop: "evaluateindex1name", type: "string"},
        {label: "编号", prop: "evaluateid", type: "string"},
        {label: "I内容", prop: "evaluateindex1content", type: "string"},
        // {label: "I内容", prop: "evaluateindex2", type: "string"},
      ],
      editForm: {},
      editVisible: false,
      currentIndex: null,
      rules:{
        // "schoolcode": [
        //   {required: true, trigger:'blur', message:"输入学校编号"}
        // ],
        "schooltypecode": [
          {required: true, trigger:'blur', message:"输入学校类型编码"}
        ],
        // "schoollocationname": [
        //   {required: true, trigger:'blur', message:"输入学校位置"}
        // ],
        // "schoollocationcode": [
        //   {required: true, trigger:'blur', message:"输入学校位置编号"}
        // ],
        // "schoollocationtypecode": [
        //   {required: true, trigger:'blur', message:"输入学校位置类型"}
        // ],
        // "schooltypecode": [
        //   {required: true, trigger:'blur', message:"输入学校类型编码"}
        // ],
        // "schoolhostcode": [
        //   {required: true, trigger:'blur', message:"输入学校主要编号"}
        // ],
      }
    }
  },
  created() {
      const _this=this
      const a=localStorage.getItem("access-schooluser")
      if(a){
        // 当前学校被安排的评估任务
        axios.get('http://localhost:8081/evaluateindex123school/evaluateindex1/'+this.evaluatetaskid).then(function (res){
          _this.tableData=res.data
        })
        axios.get('http://localhost:8081/evaluateindex123school/evaluateindex2/'+this.evaluatetaskid).then(function (res){
          _this.tableData2=res.data
        })
        axios.get('http://localhost:8081/evaluateindex123school/evaluateindex3/'+this.evaluatetaskid).then(function (res){
          _this.tableData3=res.data
        })


        // axios.get('http://localhost:8081/evaluateindex1/findAll').then(function (res){
        //   _this.tableData=res.data
        // })
        // axios.get('http://localhost:8081/evaluateindex2/findAll').then(function (res){
        //   _this.tableData2=res.data
        // })
        // axios.get('http://localhost:8081/evaluateindex3/findAll').then(function (res){
        //   _this.tableData3=res.data
        // })
      }
      else{
        this.$alert('未登录','提示',{
          confirmButtonText:'确定'
        }).then((res)=>{
          this.$router.replace({path:'/login'})
        })
      }
  }
}
</script>
